package com.bw.module_my.view

import androidx.recyclerview.widget.GridLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.SPUtils
import com.bw.lib_base.path.RouterPath
import com.bw.lib_common.view.BaseMvvmFragment
import com.bw.module_my.R
import com.bw.module_my.adapter.MyAdapter
import com.bw.module_my.databinding.FragmentMyBinding
import com.bw.module_my.entity.MyEntity

@Route(path = RouterPath.PATH_FRAGMENT_MINE)
class MyFragment : BaseMvvmFragment<FragmentMyBinding>() {

    private val mineAdapter: MyAdapter = MyAdapter()

    override fun observeDataChange() {
    }

    override fun initViews() {
        super.initViews()
        mDataBinding.rv.layoutManager = GridLayoutManager(requireContext(),4)
        mDataBinding.rv.adapter = mineAdapter
        mineAdapter.data.add(MyEntity("访客管理",R.drawable.mine_03))
        mineAdapter.data.add(MyEntity("物业服务",R.drawable.mine_05))
        mineAdapter.data.add(MyEntity("社区活动",R.drawable.mine_07))
        mineAdapter.data.add(MyEntity("设施预约",R.drawable.mine_09))
        mineAdapter.data.add(MyEntity("生活服务",R.drawable.mine_15))
        mineAdapter.data.add(MyEntity("门禁管理",R.drawable.mine_16))
        mineAdapter.notifyDataSetChanged()

        mDataBinding.tvUsername.text=SPUtils.getInstance().getString("username","金丽娜")
    }
    override fun getLayoutId(): Int =R.layout.fragment_my

}